package com.atguigu.srb.core.service.impl;

import com.atguigu.srb.base.util.JwtUtils;
import com.atguigu.srb.core.entity.IntegralGrade;
import com.atguigu.srb.core.mapper.IntegralGradeMapper;
import com.atguigu.srb.core.service.IntegralGradeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * <p>
 * 积分等级表 服务实现类
 * </p>
 *
 * @author Atguigu
 * @since 2023-06-30
 */
@Service
public class IntegralGradeServiceImpl extends ServiceImpl<IntegralGradeMapper, IntegralGrade> implements IntegralGradeService {
    @Resource
    IntegralGradeMapper integralGradeMapper;
    @Override
    public BigDecimal getAmount(String token) {
        Long userId = JwtUtils.getUserId(token);
        //根据用户的id查询可借款的额度
        // BigDecimal amount = integralGradeMapper.getAmount(userId);
        return integralGradeMapper.getAmount(userId);
    }
}
